﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using OA.Bll.Project;

namespace OA.Web.Project.Handler
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class ProjectPayBackTreeHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string type = context.Request["type"];
            string id = context.Request["id"];
            string result = string.Empty;
            ProjectPayBackPresenter ppbp = new ProjectPayBackPresenter();
            if (string.IsNullOrEmpty(type))
            {
                string internaltype = context.Request["internaltype"];
                string projectNum = context.Request["projectNum"];
                string projectName = context.Request["projectName"];
                result = ppbp.SearchProjectTree(internaltype,projectNum,projectName);
            }
            else if (type == "ProjectPayBackInfo")
            {
                result = ppbp.SearchTree(id);
            }
            else if (type == "ProjectIncomeInfo")
            {
                result = ppbp.SearchProjectIncomeTree(id);
            }
            else if (type == "ProjectCashInfo")
            {
                result = ppbp.SearchProjectCashTree(id);
            }
            context.Response.Write(result);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
